package Entities

type CommonResponse struct {
	Msg  string      `json:"msg"`
	Code int         `json:"code"`
	Data interface{} `json:"data"`
}

var (
	ParameterErrorResponse = &CommonResponse{Msg: "Parameter invalid", Code: 1, Data: ""}
	VerifyFailedResponse   = &CommonResponse{Msg: "Verify failed", Code: 2, Data: ""}
	JWTSignFailedRepsonse  = &CommonResponse{Msg: "Fail to sign JWT", Code: 3, Data: ""}
	ServerErrorResponse    = &CommonResponse{Msg: "Server Error", Code: 4, Data: ""}
)

func GetResponse(msg string, code int, data interface{}) CommonResponse {
	return CommonResponse{Msg: msg, Code: code, Data: data}
}
func GetSuccessResponse(data interface{}) CommonResponse {
	return CommonResponse{Msg: "success", Code: 0, Data: data}
}
func GetBadResponse() CommonResponse {
	return CommonResponse{Msg: "Server error", Code: 4, Data: ""}
}
